M = {}

M.init = function()
    local map = vim.keymap.set
    map("n", "<leader>p", '"*p', {
        silent = true,
        desc = "Paste from mouse"
    })
    map("n", "<leader>P", '"*P', {
        silent = true,
        desc = "Paste before from mouse"
    })
    -- etc
    map('n', '<leader>w', ':w<CR>',{noremap = true})
    map('n', '<leader>q', ':q!<CR>',{noremap = true})
    map('n', '<leader>s', ':so %<CR>',{noremap = true})
    map('n', '<leader>ev', ':vsplit $MYVIMRC<CR>',{noremap = true})
    map('n', '<leader>sv', ':w<CR>:so %<CR>:q<CR>',{noremap = true})
    map('i', 'jk', '<ESC>', {noremap = true})
    map('n', ';', ':', {noremap = true})    

    -- telescope
    local builtin = require('telescope.builtin')
    vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
    vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
    vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
    vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
end

-- And other plugin keymaps like this
M.trouble = {
    -- ...
}

M.buf_lsp = function(_, buffer)
    local map = vim.keymap.set
    map("n", "<localleader>D", vim.lsp.buf.declaration, {
        silent = true,
        buffer = buffer,
        desc = "Declaration"
    })
    map("n", "<localleader>d", vim.lsp.buf.definition, {
        silent = true,
        buffer = buffer,
        desc = "Definition"
    })
    -- etc
end

return M
